# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-threatcrowd
pkgname=('python2-threatcrowd' 'python-threatcrowd')
_pkgname=threatcrowd
pkgver=0.4
pkgrel=9
pkgdesc='Library for working with the threatcrowd api.'
arch=('any')
url='https://pypi.python.org/pypi/threatcrowd/'
license=('custom:unknown')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://pypi.python.org/packages/5a/02/8db9f02b97c4a42b49413e1dd9684a26eede084c3270bc9755604741d015/$_pkgname-$pkgver.tar.gz")
sha512sums=('1d63c9d3d360bc29dafb5b37b309ea06c606ed950f9eb79a1c7a8c42e1e69751e14f434710b749c3e4418cd0392df77cf39c7ad8dfe0b5fabdcd5b01777f04dd')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-threatcrowd() {
  depends=('python2' 'python2-requests')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-threatcrowd() {
  depends=('python' 'python-requests')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

